package com.xxl.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.validation.annotation.Validated;

import java.util.List;

/**
 * @author xxl
 * @date 2023/3/19
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Validated
@Schema(description = "用户实体类")
public class User {
    @Schema(description = "用户姓名")
    @NotNull(message = "名字不能为空")
    @NotEmpty(message = "名字不能为空字符")
    private String name;
    @Schema(description = "用户年龄")
    @Min(value = 18,message = "年龄最小不能低于18岁")
    @Max(value = 25,message = "年龄最大不能为25岁")
    private int age;
    @Valid
    private List<Hobby> hobbies;
}
